<?php

defined('IN_IA') or exit('Access Denied');
define('FRAME', 'ext');
$multiid = intval($_GPC['multiid']);
checklogin();
$multi = pdo_fetch('SELECT * FROM ' . tablename('site_multi') . ' WHERE uid = :uid AND id = :id', array(':uid' => $_W['uid'], ':id' => $multiid));
if (empty($multi)) {
    message('微站不存在或已删除', referer(), 'error');
}
define('FRAME', $do);
$frames = buildframes(array(FRAME), $_GPC['m']);
$frames = $frames[FRAME];

$title = '扩展功能概况';
$moudles = pdo_fetchall("SELECT * FROM " . tablename('modules'));
$mymodules = pdo_fetchall("SELECT mid, addtime, deadline FROM " . tablename('users_modules') . " where uid = ". $_W['uid']);
foreach ($moudles as $index => &$module) {
    if ($module['issystem']) {
        $path = '../framework/builtin/' . $module['name'];
    } else {
        $path = '../addons/' . $module['name'];
    }
    $cion = $path . '/icon-custom.jpg';
    if (!file_exists($cion)) {
        $cion = $path . '/icon.jpg';
        if (!file_exists($cion)) {
            $cion = './resource/images/nopic-small.jpg';
        }
    }
    $module['icon'] = $cion;
}
foreach ($mymodules as $index => &$module){
    $module = Array_merge($module, $moudles[$index]);
    unset($moudles[$index]);
}
template('module/list');